#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableChatConfigDao:DaoBase<TableChatConfig>
    {
        public override string GetFileName()
        {
            return "TableChatConfig.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableChatConfig>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableChatConfig model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.channelId)) UnityEngine.Debug.LogError("数据表id重复:TableChatConfig->id: " + model.channelId);
            #endif
            cachePrimaryInt[model.channelId] = model;
        }
        protected override TableChatConfig ParseRowData(string[] rowData)
        {
            TableChatConfig data = new TableChatConfig();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.channelId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.channelName = rowData[1];
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.canTalk = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.levelNeed = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.talkCd = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.channelPic = rowData[5];
            }
            return data;
        }
    }
}
